package bean;

import java.util.List;

import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import dao.ProvaDAO;
import model.Prova;

/**
 * Session Bean implementation class ProvaEJB
 */
@Stateless
@LocalBean
public class ProvaEJB implements ProvaEJBLocal {

	@PersistenceContext(unitName="galeradoconcurso")
	private EntityManager em;
    /**
     * Default constructor. 
     */
    public ProvaEJB() {
        // TODO Auto-generated constructor stub
    }
	@Override
	public void cadastrarProva(model.Prova p) {
		ProvaDAO dao = new ProvaDAO(em);
    	dao.adicionarProvaDAO(p);
		
	}
	@Override
	public List<Prova> listarProva() {
		ProvaDAO dao = new ProvaDAO(em);
		return dao.listar();
	}
	@Override
	public void removerProva(Prova p) {
		ProvaDAO dao = new ProvaDAO(em);
		dao.remove(p);
		
	}

}
